# Maintainer: Maxime Gauduin <alucryd@archlinux.org>

pkgname=libretro-mupen64plus-next
pkgver=454
pkgrel=1
epoch=1
pkgdesc='Nintendo 64 core'
arch=(loong64 x86_64)
url=https://github.com/libretro/mupen64plus-libretro-nx
license=(GPL2)
groups=(libretro)
depends=(
  gcc-libs
  glibc
  libgl
  libpng
  libretro-core-info
  minizip
  xxhash
  zlib
)
makedepends=(
  git
  mesa
  nasm
)
replaces=(libretro-mupen64plus)
_commit=4d270850bd09f8630110da701b73107e45a6e202
source=(libretro-mupen64plus-next::git+https://github.com/libretro/mupen64plus-libretro-nx.git#commit=${_commit})
sha256sums=(SKIP)
options=(!lto)

pkgver() {
  cd libretro-mupen64plus-next

  git rev-list --count HEAD
}

build() {
  make \
    WITH_DYNAREC=x86_64 \
    HAVE_PARALLEL_RDP=1 \
    HAVE_PARALLEL_RSP=1 \
    HAVE_THR_AL=1 \
    SYSTEM_LIBPNG=1 \
    SYSTEM_MINIZIP=1 \
    SYSTEM_XXHASH=1 \
    SYSTEM_ZLIB=1 \
    -C libretro-mupen64plus-next
}

package() {
  install -Dm 644 libretro-mupen64plus-next/mupen64plus_next_libretro.so -t "${pkgdir}"/usr/lib/libretro/
}

# vim: ts=2 sw=2 et:
